#!/usr/bin/python3
L = []
while True:
    s = input()
    if not s:
        break
    L.append(s)
L.reverse()
cnt = 0
for line in L:
    cnt += len(line)
    print(line)
print(cnt)
